package gherkinedit.handlers;

import gherkinedit.wizard.InsertFromTemplateWizard;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
//import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;

/**
 * This command handler handles when the user activates the commands in the Template menu
 * 
 */
public class InsertFromTemplateCommandHandler extends AbstractHandler {
	
	/**
	 * A command has been executed.
	 * 
	 */
	public Object execute(ExecutionEvent event) throws ExecutionException {
		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
		
		WizardDialog wizardDialog = new WizardDialog(window.getShell(), new InsertFromTemplateWizard());
		
		if (wizardDialog.open() == Window.OK) {
			System.out.println("User pressed Finish");
		} else {
			System.out.println("User pressed Cancel");
		}
		return null;
	}
}
